#!/bin/sh
 
. $HOME/sqllib/db2profile

function shutdown()
{
    $HOME/sqllib/adm/db2stop force
}
 
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP

$HOME/sqllib/adm/db2start
 

while true; do
    sleep 2
    pscount=`$HOME/sqllib/bin/db2_local_ps|grep db2sysc|wc -l`
    if [ "$pscount" -eq 0 ]; then
        exit 0
    fi
done
